/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package bpmn.provider;


import bpmn.BpmnFactory;
import bpmn.BpmnPackage;

import java.util.Collection;
import java.util.List;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EStructuralFeature;

import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;

/**
 * This is the item provider adapter for a {@link bpmn.Process} object.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public class ProcessItemProvider
	extends SupportingElementItemProvider
	implements
		IEditingDomainItemProvider,
		IStructuredItemContentProvider,
		ITreeItemContentProvider,
		IItemLabelProvider,
		IItemPropertySource {
	/**
	 * This constructs an instance from a factory and a notifier.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ProcessItemProvider(AdapterFactory adapterFactory) {
		super(adapterFactory);
	}

	/**
	 * This returns the property descriptors for the adapted class.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
		if (itemPropertyDescriptors == null) {
			super.getPropertyDescriptors(object);

			addNamePropertyDescriptor(object);
			addProcessTypePropertyDescriptor(object);
			addStatusPropertyDescriptor(object);
			addAssignmentsPropertyDescriptor(object);
			addPerformersPropertyDescriptor(object);
			addInputSetsPropertyDescriptor(object);
			addOutputSetsPropertyDescriptor(object);
			addAdHocPropertyDescriptor(object);
			addAdHocOrderingPropertyDescriptor(object);
			addAdHocCompletionConditionPropertyDescriptor(object);
		}
		return itemPropertyDescriptors;
	}

	/**
	 * This adds a property descriptor for the Name feature.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void addNamePropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_Process_Name_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_Process_Name_feature", "_UI_Process_type"),
				 BpmnPackage.Literals.PROCESS__NAME,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Process Type feature.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void addProcessTypePropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_Process_ProcessType_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_Process_ProcessType_feature", "_UI_Process_type"),
				 BpmnPackage.Literals.PROCESS__PROCESS_TYPE,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Status feature.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void addStatusPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_Process_Status_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_Process_Status_feature", "_UI_Process_type"),
				 BpmnPackage.Literals.PROCESS__STATUS,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Assignments feature.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void addAssignmentsPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_Process_Assignments_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_Process_Assignments_feature", "_UI_Process_type"),
				 BpmnPackage.Literals.PROCESS__ASSIGNMENTS,
				 true,
				 false,
				 true,
				 null,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Performers feature.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void addPerformersPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_Process_Performers_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_Process_Performers_feature", "_UI_Process_type"),
				 BpmnPackage.Literals.PROCESS__PERFORMERS,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Input Sets feature.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void addInputSetsPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_Process_InputSets_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_Process_InputSets_feature", "_UI_Process_type"),
				 BpmnPackage.Literals.PROCESS__INPUT_SETS,
				 true,
				 false,
				 true,
				 null,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Output Sets feature.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void addOutputSetsPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_Process_OutputSets_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_Process_OutputSets_feature", "_UI_Process_type"),
				 BpmnPackage.Literals.PROCESS__OUTPUT_SETS,
				 true,
				 false,
				 true,
				 null,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Ad Hoc feature.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void addAdHocPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_Process_AdHoc_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_Process_AdHoc_feature", "_UI_Process_type"),
				 BpmnPackage.Literals.PROCESS__AD_HOC,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Ad Hoc Ordering feature.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void addAdHocOrderingPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_Process_AdHocOrdering_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_Process_AdHocOrdering_feature", "_UI_Process_type"),
				 BpmnPackage.Literals.PROCESS__AD_HOC_ORDERING,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Ad Hoc Completion Condition feature.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void addAdHocCompletionConditionPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_Process_AdHocCompletionCondition_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_Process_AdHocCompletionCondition_feature", "_UI_Process_type"),
				 BpmnPackage.Literals.PROCESS__AD_HOC_COMPLETION_CONDITION,
				 true,
				 false,
				 true,
				 null,
				 null,
				 null));
	}

	/**
	 * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
	 * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
	 * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
		if (childrenFeatures == null) {
			super.getChildrenFeatures(object);
			childrenFeatures.add(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS);
			childrenFeatures.add(BpmnPackage.Literals.PROCESS__PROPERTIES);
		}
		return childrenFeatures;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EStructuralFeature getChildFeature(Object object, Object child) {
		// Check the type of the specified child object and return the proper feature to use for
		// adding (see {@link AddCommand}) it as a child.

		return super.getChildFeature(object, child);
	}

	/**
	 * This returns Process.gif.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object getImage(Object object) {
		return overlayImage(object, getResourceLocator().getImage("full/obj16/Process"));
	}

	/**
	 * This returns the label text for the adapted class.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String getText(Object object) {
		String label = ((bpmn.Process)object).getName();
		return label == null || label.length() == 0 ?
			getString("_UI_Process_type") :
			getString("_UI_Process_type") + " " + label;
	}

	/**
	 * This handles model notifications by calling {@link #updateChildren} to update any cached
	 * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void notifyChanged(Notification notification) {
		updateChildren(notification);

		switch (notification.getFeatureID(bpmn.Process.class)) {
			case BpmnPackage.PROCESS__NAME:
			case BpmnPackage.PROCESS__PROCESS_TYPE:
			case BpmnPackage.PROCESS__STATUS:
			case BpmnPackage.PROCESS__PERFORMERS:
			case BpmnPackage.PROCESS__AD_HOC:
			case BpmnPackage.PROCESS__AD_HOC_ORDERING:
				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
				return;
			case BpmnPackage.PROCESS__GRAPHICAL_ELEMENTS:
			case BpmnPackage.PROCESS__PROPERTIES:
				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
				return;
		}
		super.notifyChanged(notification);
	}

	/**
	 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
	 * that can be created under this object.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
		super.collectNewChildDescriptors(newChildDescriptors, object);

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createAnnotation()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createAssociation()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createComplex()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createExclusive()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createDataBased()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createDataObject()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createSubProcess()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createEmbedded()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createEnd()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createEventBased()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createGroup()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createInclusive()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createIntermediate()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createLane()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createTask()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createManual()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createMessageFlow()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createMultiInstanceLoopActivity()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createNone()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createParallel()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createPool()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createReceive()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createReferenceSubProcess()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createReferenceTask()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createReusable()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createScript()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createSend()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createSequenceFlow()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createService()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createStandardLoopActivity()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createStart()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__GRAPHICAL_ELEMENTS,
				 BpmnFactory.eINSTANCE.createUser()));

		newChildDescriptors.add
			(createChildParameter
				(BpmnPackage.Literals.PROCESS__PROPERTIES,
				 BpmnFactory.eINSTANCE.createProperty()));
	}

}
